Skip to content

nbd: don't warn when reclassifying a busy socket lock#982

Open
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1114410=>linus-master
Open

nbd: don't warn when reclassifying a busy socket lock#982
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1114410=>linus-master

Conversation

@blktests-ci

@blktests-ci blktests-ci Bot commented Jun 22, 2026

Copy link
Copy Markdown

Pull request for series with
subject: nbd: don't warn when reclassifying a busy socket lock
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1114410

@blktests-ci

blktests-ci Bot commented Jun 22, 2026

Copy link
Copy Markdown
Author

Upstream branch: 66affa3
series: https://patchwork.kernel.org/project/linux-block/list/?series=1114410
version: 1

@blktests-ci

blktests-ci Bot commented Jun 22, 2026

Copy link
Copy Markdown
Author

Upstream branch: 66affa3
series: https://patchwork.kernel.org/project/linux-block/list/?series=1114410
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1114410=>linus-master branch from 8f83aac to eb4e9e9 Compare June 22, 2026 09:03
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from e6d9eb8 to 7d8604f Compare June 24, 2026 01:11
nbd_reclassify_socket() warns via WARN_ON_ONCE() if the socket lock is
held at the point of reclassification. That assertion was copied from
nvme-tcp, where the socket is created internally by the kernel
(sock_create_kern()) and is never visible to user space, so the lock
is guaranteed to be free.

NBD is different: the socket is looked up from a user-supplied fd in
nbd_get_socket(), and user space retains that fd. A concurrent syscall
on the same socket (or softirq processing taking bh_lock_sock() on a
connected TCP socket) can legitimately hold the lock at the instant
NBD reclassifies it. sock_allow_reclassification() then returns false
and the WARN_ON_ONCE() fires, which turns into a crash under
panic_on_warn. This is reachable by simply racing NBD_CMD_CONNECT
against socket activity on the same fd, as reported by syzbot.

Hitting a held lock here is expected for an externally owned socket and
is not a kernel bug, so skip reclassification silently instead of
warning. Reclassification is a lockdep-only annotation, so skipping it
in the rare racing case is harmless.

Reported-by: syzbot+6b85d1e39a5b8ed9a954@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6b85d1e39a5b8ed9a954
Fixes: d532cdd ("nbd: Reclassify sockets to avoid lockdep circular dependency")
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
Acked-by: Eric Dumazet <edumazet@google.com>
@blktests-ci

blktests-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown
Author

Upstream branch: bade58e
series: https://patchwork.kernel.org/project/linux-block/list/?series=1114410
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1114410=>linus-master branch from eb4e9e9 to a99432c Compare June 24, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant